package org.finir.fakturisanje.persistence.beans;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.finir.fakturisanje.persistence.PoreskaTarifa;
import org.finir.fakturisanje.persistence.StavkaFakture;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Entity
@Name("porez")
@Scope(ScopeType.PAGE)
public class PoreskaTarifaBean implements PoreskaTarifa, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Long id;
	private String naziv;
	private Double akciza;
	private Double iznosPoreza;

	private List<StavkaFakture> stavkeFakture;

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#getStavkeFakture()
	 */
	@OneToMany(targetEntity = StavkaFaktureBean.class, cascade = CascadeType.ALL, mappedBy = "poreskaTarifa")
	public List<StavkaFakture> getStavkeFakture() {
		return stavkeFakture;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#setStavkeFakture(java.util.List)
	 */
	public void setStavkeFakture(List<StavkaFakture> stavkeFakture) {
		this.stavkeFakture = stavkeFakture;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof PoreskaTarifaBean)) {
			return false;
		}
		PoreskaTarifaBean other = (PoreskaTarifaBean) object;
		if ((this.id == null && other.id != null)
				|| (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return naziv + " id=" + id;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#getId()
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#setId(java.lang.Long)
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#getNaziv()
	 */
	public String getNaziv() {
		return naziv;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#setNaziv(java.lang.String)
	 */
	public void setNaziv(String naziv) {
		this.naziv = naziv;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#getAkciza()
	 */
	public Double getAkciza() {
		return akciza;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#setAkciza(java.lang.Double)
	 */
	public void setAkciza(Double akciza) {
		this.akciza = akciza;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#getIznosPoreza()
	 */
	public Double getIznosPoreza() {
		return iznosPoreza;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see domain.beans.d#setIznosPoreza(java.lang.Double)
	 */
	public void setIznosPoreza(Double iznosPoreza) {
		this.iznosPoreza = iznosPoreza;
	}

}
